package maiyatian.videolive.fragment;

import android.content.Context;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.WebView;

import org.xutils.view.annotation.ContentView;
import org.xutils.view.annotation.ViewInject;
import org.xutils.x;

import maiyatian.videolive.IFragment;
import maiyatian.videolive.R;
import maiyatian.videolive.activity.WebviewActivity;

/**
 * 作者：${王中阳} on 2016/5/11 11:57
 * 邮箱：wangzhongyang@maiyatian.com
 * QQ(微信):425772719
 */
@ContentView(R.layout.content_webview)
public class WebviewFragment extends IFragment {
    public static final String TAG = "WebviewFragment";

    WebviewActivity mycontext;

    @ViewInject(R.id.webview)
    WebView webView;

    public WebviewFragment() {

    }

    public static WebviewFragment newInstance() {
        WebviewFragment fragment = new WebviewFragment();
        return fragment;
    }

    @Override
    public void onAttach(Context context) {
        super.onAttach(context);
        this.mycontext = (WebviewActivity) context;

    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        return x.view().inject(this, inflater, container);
    }

    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        webView.loadUrl(mycontext.getIntentURL());
    }
}
